home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / galaga.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  26KB  |  684 lines

  1. /***************************************************************************
  2.  
  3. Galaga memory map (preliminary)
  4.  
  5. CPU #1:
  6. 0000-3fff ROM
  7. CPU #2:
  8. 0000-1fff ROM
  9. CPU #3:
  10. 0000-1fff ROM
  11. ALL CPUS:
  12. 8000-83ff Video RAM
  13. 8400-87ff Color RAM
  14. 8b80-8bff sprite code/color
  15. 9380-93ff sprite position
  16. 9b80-9bff sprite control
  17. 8800-9fff RAM
  18.  
  19. read:
  20. 6800-6807 dip switches (only bits 0 and 1 are used - bit 0 is DSW1, bit 1 is DSW2)
  21.       dsw1:
  22.         bit 6-7 lives
  23.         bit 3-5 bonus
  24.         bit 0-2 coins per play
  25.           dsw2: (bootleg version, the original version is slightly different)
  26.             bit 7 cocktail/upright (1 = upright)
  27.         bit 6 ?
  28.         bit 5 RACK TEST
  29.         bit 4 pause (0 = paused, 1 = not paused)
  30.         bit 3 ?
  31.         bit 2 ?
  32.         bit 0-1 difficulty
  33. 7000-     custom IO chip return values
  34. 7100      custom IO chip status ($10 = command executed)
  35.  
  36. write:
  37. 6805      sound voice 1 waveform (nibble)
  38. 6811-6813 sound voice 1 frequency (nibble)
  39. 6815      sound voice 1 volume (nibble)
  40. 680a      sound voice 2 waveform (nibble)
  41. 6816-6818 sound voice 2 frequency (nibble)
  42. 681a      sound voice 2 volume (nibble)
  43. 680f      sound voice 3 waveform (nibble)
  44. 681b-681d sound voice 3 frequency (nibble)
  45. 681f      sound voice 3 volume (nibble)
  46. 6820      cpu #1 irq acknowledge/enable
  47. 6821      cpu #2 irq acknowledge/enable
  48. 6822      cpu #3 nmi acknowledge/enable
  49. 6823      if 0, halt CPU #2 and #3
  50. 6830      Watchdog reset?
  51. 7000-     custom IO chip parameters
  52. 7100      custom IO chip command (see machine/galaga.c for more details)
  53. a000-a001 starfield scroll speed (only bit 0 is significant)
  54. a002      starfield scroll direction (0 = backwards) (only bit 0 is significant)
  55. a003-a004 starfield blink
  56. a005      starfield enable
  57. a007      flip screen
  58.  
  59. Interrupts:
  60. CPU #1 IRQ mode 1
  61.        NMI is triggered by the custom IO chip to signal the CPU to read/write
  62.            parameters
  63. CPU #2 IRQ mode 1
  64. CPU #3 NMI (@120Hz)
  65.  
  66. ***************************************************************************/
  67.  
  68. #include "driver.h"
  69. #include "vidhrdw/generic.h"
  70.  
  71.  
  72.  
  73. extern unsigned char *galaga_sharedram;
  74. READ_HANDLER( galaga_hiscore_print_r );
  75. READ_HANDLER( galaga_sharedram_r );
  76. WRITE_HANDLER( galaga_sharedram_w );
  77. READ_HANDLER( galaga_dsw_r );
  78. WRITE_HANDLER( galaga_interrupt_enable_1_w );
  79. WRITE_HANDLER( galaga_interrupt_enable_2_w );
  80. WRITE_HANDLER( galaga_interrupt_enable_3_w );
  81. READ_HANDLER( galaga_customio_r );
  82. READ_HANDLER( galaga_customio_data_r );
  83. WRITE_HANDLER( galaga_customio_w );
  84. WRITE_HANDLER( galaga_customio_data_w );
  85. WRITE_HANDLER( galaga_halt_w );
  86. int galaga_interrupt_1(void);
  87. int galaga_interrupt_2(void);
  88. int galaga_interrupt_3(void);
  89. void galaga_init_machine(void);
  90.  
  91.  
  92. extern unsigned char *galaga_starcontrol;
  93. WRITE_HANDLER( galaga_flipscreen_w );
  94. int galaga_vh_start(void);
  95. void galaga_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  96. void galaga_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  97.  
  98. WRITE_HANDLER( pengo_sound_w );
  99. extern unsigned char *pengo_soundregs;
  100.  
  101.  
  102.  
  103. static struct MemoryReadAddress readmem_cpu1[] =
  104. {
  105.     { 0x8000, 0x9fff, galaga_sharedram_r },
  106.     { 0x6800, 0x6807, galaga_dsw_r },
  107.     { 0x7000, 0x700f, galaga_customio_data_r },
  108.     { 0x7100, 0x7100, galaga_customio_r },
  109.     { 0x0000, 0x3fff, MRA_ROM },
  110.     { -1 }  /* end of table */
  111. };
  112.  
  113. static struct MemoryReadAddress readmem_cpu2[] =
  114. {
  115.     { 0x8000, 0x9fff, galaga_sharedram_r },
  116.     { 0x6800, 0x6807, galaga_dsw_r },
  117.     { 0x0000, 0x1fff, MRA_ROM },
  118.     { -1 }  /* end of table */
  119. };
  120.  
  121. static struct MemoryReadAddress readmem_cpu3[] =
  122. {
  123.     { 0x8000, 0x9fff, galaga_sharedram_r },
  124.     { 0x6800, 0x6807, galaga_dsw_r },
  125.     { 0x0000, 0x1fff, MRA_ROM },
  126.     { -1 }  /* end of table */
  127. };
  128.  
  129. static struct MemoryWriteAddress writemem_cpu1[] =
  130. {
  131.     { 0x8000, 0x9fff, galaga_sharedram_w, &galaga_sharedram },
  132.     { 0x6830, 0x6830, MWA_NOP },
  133.     { 0x7000, 0x700f, galaga_customio_data_w },
  134.     { 0x7100, 0x7100, galaga_customio_w },
  135.     { 0xa000, 0xa005, MWA_RAM, &galaga_starcontrol },
  136.     { 0x6820, 0x6820, galaga_interrupt_enable_1_w },
  137.     { 0x6822, 0x6822, galaga_interrupt_enable_3_w },
  138.     { 0x6823, 0x6823, galaga_halt_w },
  139.     { 0xa007, 0xa007, galaga_flipscreen_w },
  140.     { 0x0000, 0x3fff, MWA_ROM },
  141.     { 0x8b80, 0x8bff, MWA_RAM, &spriteram, &spriteram_size },       /* these three are here just to initialize */
  142.     { 0x9380, 0x93ff, MWA_RAM, &spriteram_2 },      /* the pointers. The actual writes are */
  143.     { 0x9b80, 0x9bff, MWA_RAM, &spriteram_3 },      /* handled by galaga_sharedram_w() */
  144.     { 0x8000, 0x83ff, MWA_RAM, &videoram, &videoram_size }, /* dirtybuffer[] handling is not needed because */
  145.     { 0x8400, 0x87ff, MWA_RAM, &colorram }, /* characters are redrawn every frame */
  146.     { -1 }  /* end of table */
  147. };
  148.  
  149. static struct MemoryWriteAddress writemem_cpu2[] =
  150. {
  151.     { 0x8000, 0x9fff, galaga_sharedram_w },
  152.     { 0x6821, 0x6821, galaga_interrupt_enable_2_w },
  153.     { 0x0000, 0x1fff, MWA_ROM },
  154.     { -1 }  /* end of table */
  155. };
  156.  
  157. static struct MemoryWriteAddress writemem_cpu3[] =
  158. {
  159.     { 0x8000, 0x9fff, galaga_sharedram_w },
  160.     { 0x6800, 0x681f, pengo_sound_w, &pengo_soundregs },
  161.     { 0x6822, 0x6822, galaga_interrupt_enable_3_w },
  162.     { 0x0000, 0x1fff, MWA_ROM },
  163.     { -1 }  /* end of table */
  164. };
  165.  
  166.  
  167.  
  168. INPUT_PORTS_START( galaga )
  169.     PORT_START      /* DSW0 */
  170.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
  171.     PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
  172.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  173.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
  174.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  175.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_3C ) )
  176.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
  177.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  178.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  179.     /* TODO: bonus scores are different for 5 lives */
  180.     PORT_DIPNAME( 0x38, 0x10, DEF_STR( Bonus_Life ) )
  181.     PORT_DIPSETTING(    0x20, "20K 60K 60K" )
  182.     PORT_DIPSETTING(    0x18, "20K 60K" )
  183.     PORT_DIPSETTING(    0x10, "20K 70K 70K" )
  184.     PORT_DIPSETTING(    0x30, "20K 80K 80K" )
  185.     PORT_DIPSETTING(    0x38, "30K 80K" )
  186.     PORT_DIPSETTING(    0x08, "30K 100K 100K" )
  187.     PORT_DIPSETTING(    0x28, "30K 120K 120K" )
  188.     PORT_DIPSETTING(    0x00, "None" )
  189.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
  190.     PORT_DIPSETTING(    0x00, "2" )
  191.     PORT_DIPSETTING(    0x80, "3" )
  192.     PORT_DIPSETTING(    0x40, "4" )
  193.     PORT_DIPSETTING(    0xc0, "5" )
  194.  
  195.     PORT_START      /* DSW1 */
  196.     PORT_DIPNAME( 0x01, 0x01, "2 Credits Game" )
  197.     PORT_DIPSETTING(    0x00, "1 Player" )
  198.     PORT_DIPSETTING(    0x01, "2 Players" )
  199.     PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
  200.     PORT_DIPSETTING(    0x06, "Easy" )
  201.     PORT_DIPSETTING(    0x00, "Medium" )
  202.     PORT_DIPSETTING(    0x02, "Hard" )
  203.     PORT_DIPSETTING(    0x04, "Hardest" )
  204.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
  205.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  206.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  207.     PORT_DIPNAME( 0x10, 0x10, "Freeze" )
  208.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  209.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  210.     PORT_BITX(    0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
  211.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  212.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  213.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  214.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  215.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  216.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  217.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  218.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  219.  
  220.     PORT_START      /* FAKE */
  221.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  222.     /* These fake input ports are read by galaga_customio_data_r() */
  223.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  224.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  225.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  226.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  227.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
  228.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  229.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  230.  
  231.     PORT_START      /* FAKE */
  232.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  233.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  234.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  235.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  236.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
  237.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  238.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  239.  
  240.     PORT_START      /* FAKE */
  241.     /* the button here is used to trigger the sound in the test screen */
  242.     PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,     0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  243.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
  244.     PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
  245.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
  246.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
  247.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
  248.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  249. INPUT_PORTS_END
  250.  
  251. /* same as galaga, dip switches are slightly different */
  252. INPUT_PORTS_START( galaganm )
  253.     PORT_START      /* DSW0 */
  254.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
  255.     PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
  256.     PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
  257.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
  258.     PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
  259.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_3C ) )
  260.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
  261.     PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
  262.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  263.     /* TODO: bonus scores are different for 5 lives */
  264.     PORT_DIPNAME( 0x38, 0x10, DEF_STR( Bonus_Life ) )
  265.     PORT_DIPSETTING(    0x20, "20K 60K 60K" )
  266.     PORT_DIPSETTING(    0x18, "20K 60K" )
  267.     PORT_DIPSETTING(    0x10, "20K 70K 70K" )
  268.     PORT_DIPSETTING(    0x30, "20K 80K 80K" )
  269.     PORT_DIPSETTING(    0x38, "30K 80K" )
  270.     PORT_DIPSETTING(    0x08, "30K 100K 100K" )
  271.     PORT_DIPSETTING(    0x28, "30K 120K 120K" )
  272.     PORT_DIPSETTING(    0x00, "None" )
  273.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Lives ) )
  274.     PORT_DIPSETTING(    0x00, "2" )
  275.     PORT_DIPSETTING(    0x80, "3" )
  276.     PORT_DIPSETTING(    0x40, "4" )
  277.     PORT_DIPSETTING(    0xc0, "5" )
  278.  
  279.     PORT_START      /* DSW1 */
  280.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  281.     PORT_DIPSETTING(    0x03, "Easy" )
  282.     PORT_DIPSETTING(    0x00, "Medium" )
  283.     PORT_DIPSETTING(    0x01, "Hard" )
  284.     PORT_DIPSETTING(    0x02, "Hardest" )
  285.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
  286.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  287.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  288.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
  289.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  290.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  291.     PORT_DIPNAME( 0x10, 0x10, "Freeze" )
  292.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  293.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  294.     PORT_BITX(    0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
  295.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  296.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  297.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
  298.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  299.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  300.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  301.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  302.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  303.  
  304.     PORT_START      /* FAKE */
  305.     /* The player inputs are not memory mapped, they are handled by an I/O chip. */
  306.     /* These fake input ports are read by galaga_customio_data_r() */
  307.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  308.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  309.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  310.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  311.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1, 1 )
  312.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  313.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  314.  
  315.     PORT_START      /* FAKE */
  316.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  317.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  318.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  319.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  320.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 1 )
  321.     PORT_BITX(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL, 0, IP_KEY_PREVIOUS, IP_JOY_PREVIOUS )
  322.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  323.  
  324.     PORT_START      /* FAKE */
  325.     /* the button here is used to trigger the sound in the test screen */
  326.     PORT_BITX(0x03, IP_ACTIVE_LOW, IPT_BUTTON1,     0, IP_KEY_DEFAULT, IP_JOY_DEFAULT )
  327.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_LOW, IPT_START1, 1 )
  328.     PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_LOW, IPT_START2, 1 )
  329.     PORT_BIT_IMPULSE( 0x10, IP_ACTIVE_LOW, IPT_COIN1, 1 )
  330.     PORT_BIT_IMPULSE( 0x20, IP_ACTIVE_LOW, IPT_COIN2, 1 )
  331.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 1 )
  332.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  333. INPUT_PORTS_END
  334.  
  335.  
  336.  
  337. static struct GfxLayout charlayout =
  338. {
  339.     8,8,           /* 8*8 characters */
  340.     128,           /* 128 characters */
  341.     2,             /* 2 bits per pixel */
  342.     { 0, 4 },       /* the two bitplanes for 4 pixels are packed into one byte */
  343.     { 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },   /* bits are packed in groups of four */
  344.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },   /* characters are rotated 90 degrees */
  345.     16*8           /* every char takes 16 bytes */
  346. };
  347.  
  348. static struct GfxLayout spritelayout =
  349. {
  350.     16,16,          /* 16*16 sprites */
  351.     128,            /* 128 sprites */
  352.     2,              /* 2 bits per pixel */
  353.     { 0, 4 },       /* the two bitplanes for 4 pixels are packed into one byte */
  354.     { 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
  355.             24*8+0, 24*8+1, 24*8+2, 24*8+3 },
  356.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  357.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  358.     64*8    /* every sprite takes 64 bytes */
  359. };
  360.  
  361.  
  362.  
  363. static struct GfxDecodeInfo gfxdecodeinfo[] =
  364. {
  365.     { REGION_GFX1, 0, &charlayout,       0, 32 },
  366.     { REGION_GFX2, 0, &spritelayout,  32*4, 32 },
  367.     { -1 } /* end of array */
  368. };
  369.  
  370.  
  371.  
  372. static struct namco_interface namco_interface =
  373. {
  374.     3072000/32,    /* sample rate */
  375.     3,            /* number of voices */
  376.     100,        /* playback volume */
  377.     REGION_SOUND1    /* memory region */
  378. };
  379.  
  380. static const char *galaga_sample_names[] =
  381. {
  382.     "*galaga",
  383.     "bang.wav",
  384.     0       /* end of array */
  385. };
  386.  
  387. static struct Samplesinterface samples_interface =
  388. {
  389.     1,    /* one channel */
  390.     80,    /* volume */
  391.     galaga_sample_names
  392. };
  393.  
  394.  
  395. static struct MachineDriver machine_driver_galaga =
  396. {
  397.     /* basic machine hardware */
  398.     {
  399.         {
  400.             CPU_Z80,
  401.             3125000,        /* 3.125 Mhz */
  402.             readmem_cpu1,writemem_cpu1,0,0,
  403.             galaga_interrupt_1,1
  404.         },
  405.         {
  406.             CPU_Z80,
  407.             3125000,        /* 3.125 Mhz */
  408.             readmem_cpu2,writemem_cpu2,0,0,
  409.             galaga_interrupt_2,1
  410.         },
  411.         {
  412.             CPU_Z80,
  413.             3125000,        /* 3.125 Mhz */
  414.             readmem_cpu3,writemem_cpu3,0,0,
  415.             galaga_interrupt_3,2
  416.         }
  417.     },
  418.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  419.     99,    /* 99 CPU slices per frame - with 100, galagab2 hangs on coin insertion */
  420.     galaga_init_machine,
  421.  
  422.     /* video hardware */
  423.     36*8, 28*8, { 0*8, 36*8-1, 0*8, 28*8-1 },
  424.     gfxdecodeinfo,
  425.     32+64,64*4,     /* 32 for the characters, 64 for the stars */
  426.     galaga_vh_convert_color_prom,
  427.  
  428.     VIDEO_TYPE_RASTER,
  429.     0,
  430.     galaga_vh_start,
  431.     generic_vh_stop,
  432.     galaga_vh_screenrefresh,
  433.  
  434.     /* sound hardware */
  435.     0,0,0,0,
  436.     {
  437.         {
  438.             SOUND_NAMCO,
  439.             &namco_interface
  440.         },
  441.         {
  442.             SOUND_SAMPLES,
  443.             &samples_interface
  444.         }
  445.     }
  446. };
  447.  
  448.  
  449.  
  450. /***************************************************************************
  451.  
  452.   Game driver(s)
  453.  
  454. ***************************************************************************/
  455.  
  456. ROM_START( galaga )
  457.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  458.     ROM_LOAD( "04m_g01.bin",  0x0000, 0x1000, 0xa3a0f743 )
  459.     ROM_LOAD( "04k_g02.bin",  0x1000, 0x1000, 0x43bb0d5c )
  460.     ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
  461.     ROM_LOAD( "04h_g04.bin",  0x3000, 0x1000, 0x83874442 )
  462.  
  463.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  464.     ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
  465.  
  466.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  467.     ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
  468.  
  469.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  470.     ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
  471.  
  472.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  473.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  474.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  475.  
  476.     ROM_REGION( 0x0320, REGION_PROMS )
  477.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  478.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  479.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  480.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  481.  
  482.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  483.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  484. ROM_END
  485.  
  486. ROM_START( galagamw )
  487.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  488.     ROM_LOAD( "3200a.bin",    0x0000, 0x1000, 0x3ef0b053 )
  489.     ROM_LOAD( "3300b.bin",    0x1000, 0x1000, 0x1b280831 )
  490.     ROM_LOAD( "3400c.bin",    0x2000, 0x1000, 0x16233d33 )
  491.     ROM_LOAD( "3500d.bin",    0x3000, 0x1000, 0x0aaf5c23 )
  492.  
  493.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  494.     ROM_LOAD( "3600e.bin",    0x0000, 0x1000, 0xbc556e76 )
  495.  
  496.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  497.     ROM_LOAD( "3700g.bin",    0x0000, 0x1000, 0xb07f0aa4 )
  498.  
  499.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  500.     ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
  501.  
  502.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  503.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  504.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  505.  
  506.     ROM_REGION( 0x0320, REGION_PROMS )
  507.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  508.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  509.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  510.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  511.  
  512.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  513.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  514. ROM_END
  515.  
  516. ROM_START( galagads )
  517.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  518.     ROM_LOAD( "3200a.bin",    0x0000, 0x1000, 0x3ef0b053 )
  519.     ROM_LOAD( "3300b.bin",    0x1000, 0x1000, 0x1b280831 )
  520.     ROM_LOAD( "3400c.bin",    0x2000, 0x1000, 0x16233d33 )
  521.     ROM_LOAD( "3500d.bin",    0x3000, 0x1000, 0x0aaf5c23 )
  522.  
  523.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  524.     ROM_LOAD( "3600fast.bin", 0x0000, 0x1000, 0x23d586e5 )
  525.  
  526.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  527.     ROM_LOAD( "3700g.bin",    0x0000, 0x1000, 0xb07f0aa4 )
  528.  
  529.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  530.     ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
  531.  
  532.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  533.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  534.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  535.  
  536.     ROM_REGION( 0x0320, REGION_PROMS )
  537.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  538.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  539.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  540.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  541.  
  542.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  543.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  544. ROM_END
  545.  
  546. ROM_START( gallag )
  547.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  548.     ROM_LOAD( "04m_g01.bin",  0x0000, 0x1000, 0xa3a0f743 )
  549.     ROM_LOAD( "gallag.2",     0x1000, 0x1000, 0x5eda60a7 )
  550.     ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
  551.     ROM_LOAD( "04h_g04.bin",  0x3000, 0x1000, 0x83874442 )
  552.  
  553.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  554.     ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
  555.  
  556.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  557.     ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
  558.  
  559.     ROM_REGION( 0x10000, REGION_CPU4 )    /* 64k for a Z80 which emulates the custom I/O chip (not used) */
  560.     ROM_LOAD( "gallag.6",     0x0000, 0x1000, 0x001b70bc )
  561.  
  562.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  563.     ROM_LOAD( "gallag.8",     0x0000, 0x1000, 0x169a98a4 )
  564.  
  565.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  566.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  567.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  568.  
  569.     ROM_REGION( 0x0320, REGION_PROMS )
  570.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  571.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  572.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  573.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  574.  
  575.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  576.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  577. ROM_END
  578.  
  579. ROM_START( galagab2 )
  580.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  581.     ROM_LOAD( "g1",           0x0000, 0x1000, 0xab036c9f )
  582.     ROM_LOAD( "g2",           0x1000, 0x1000, 0xd9232240 )
  583.     ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
  584.     ROM_LOAD( "g4",           0x3000, 0x1000, 0x499fcc76 )
  585.  
  586.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  587.     ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
  588.  
  589.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  590.     ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
  591.  
  592.     ROM_REGION( 0x10000, REGION_CPU4 )    /* 64k for a Z80 which emulates the custom I/O chip (not used) */
  593.     ROM_LOAD( "10h_g07.bin",  0x0000, 0x1000, 0x035e300c )
  594.  
  595.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  596.     ROM_LOAD( "gallag.8",     0x0000, 0x1000, 0x169a98a4 )
  597.  
  598.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  599.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  600.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  601.  
  602.     ROM_REGION( 0x0320, REGION_PROMS )
  603.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  604.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  605.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  606.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  607.  
  608.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  609.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  610. ROM_END
  611.  
  612. ROM_START( galaga84 )
  613.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  614.     ROM_LOAD( "g1",           0x0000, 0x1000, 0xab036c9f )
  615.     ROM_LOAD( "gal84_u2",     0x1000, 0x1000, 0x4d832a30 )
  616.     ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
  617.     ROM_LOAD( "g4",           0x3000, 0x1000, 0x499fcc76 )
  618.  
  619.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  620.     ROM_LOAD( "gal84_u5",     0x0000, 0x1000, 0xbb5caae3 )
  621.  
  622.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  623.     ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
  624.  
  625.     ROM_REGION( 0x10000, REGION_CPU4 )    /* 64k for a Z80 which emulates the custom I/O chip (not used) */
  626.     ROM_LOAD( "10h_g07.bin",  0x0000, 0x1000, 0x035e300c )
  627.  
  628.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  629.     ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
  630.  
  631.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  632.     ROM_LOAD( "gal84u4d",     0x0000, 0x1000, 0x22e339d5 )
  633.     ROM_LOAD( "gal84u4e",     0x1000, 0x1000, 0x60dcf940 )
  634.  
  635.     ROM_REGION( 0x0320, REGION_PROMS )
  636.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  637.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  638.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  639.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  640.  
  641.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  642.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  643. ROM_END
  644.  
  645. ROM_START( nebulbee )
  646.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code for the first CPU  */
  647.     ROM_LOAD( "nebulbee.01",  0x0000, 0x1000, 0xf405f2c4 )
  648.     ROM_LOAD( "nebulbee.02",  0x1000, 0x1000, 0x31022b60 )
  649.     ROM_LOAD( "04j_g03.bin",  0x2000, 0x1000, 0x753ce503 )
  650.     ROM_LOAD( "nebulbee.04",  0x3000, 0x1000, 0xd76788a5 )
  651.  
  652.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for the second CPU */
  653.     ROM_LOAD( "04e_g05.bin",  0x0000, 0x1000, 0x3102fccd )
  654.  
  655.     ROM_REGION( 0x10000, REGION_CPU3 )     /* 64k for the third CPU  */
  656.     ROM_LOAD( "04d_g06.bin",  0x0000, 0x1000, 0x8995088d )
  657.  
  658.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  659.     ROM_LOAD( "07m_g08.bin",  0x0000, 0x1000, 0x58b2f47c )
  660.  
  661.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  662.     ROM_LOAD( "07e_g10.bin",  0x0000, 0x1000, 0xad447c80 )
  663.     ROM_LOAD( "07h_g09.bin",  0x1000, 0x1000, 0xdd6f1afc )
  664.  
  665.     ROM_REGION( 0x0320, REGION_PROMS )
  666.     ROM_LOAD( "5n.bin",       0x0000, 0x0020, 0x54603c6b )    /* palette */
  667.     ROM_LOAD( "2n.bin",       0x0020, 0x0100, 0xa547d33b )    /* char lookup table */
  668.     ROM_LOAD( "1c.bin",       0x0120, 0x0100, 0xb6f585fb )    /* sprite lookup table */
  669.     ROM_LOAD( "5c.bin",       0x0220, 0x0100, 0x8bd565f6 )    /* unknown */
  670.  
  671.     ROM_REGION( 0x0100, REGION_SOUND1 )    /* sound prom */
  672.     ROM_LOAD( "1d.bin",       0x0000, 0x0100, 0x86d92b24 )
  673. ROM_END
  674.  
  675.  
  676.  
  677. GAME( 1981, galaga,   0,      galaga, galaganm, 0, ROT90, "Namco", "Galaga (Namco)" )
  678. GAME( 1981, galagamw, galaga, galaga, galaga,   0, ROT90, "[Namco] (Midway license)", "Galaga (Midway)" )
  679. GAME( 1981, galagads, galaga, galaga, galaga,   0, ROT90, "hack", "Galaga (fast shoot)" )
  680. GAME( 1982, gallag,   galaga, galaga, galaganm, 0, ROT90, "bootleg", "Gallag" )
  681. GAME( 1981, galagab2, galaga, galaga, galaganm, 0, ROT90, "bootleg", "Galaga (bootleg)" )
  682. GAME( 1984, galaga84, galaga, galaga, galaganm, 0, ROT90, "hack", "Galaga '84" )
  683. GAME( 1984, nebulbee, galaga, galaga, galaganm, 0, ROT90, "hack", "Nebulous Bee" )
  684.